package com.xhwl.centiotdata.handler.eesd.impl;

import com.xhwl.centiotdata.handler.eesd.EesdFactory;
import com.xhwl.centiotdata.handler.eesd.EesdHandler;
import com.xhwl.centiotdata.pojo.dto.eesd.EesdConfigDTO;
import com.xhwl.centiotdata.pojo.enums.eesd.EesdMethodEnum;
import com.xhwl.centiotdata.suppliersystem.eesd.batown.BaApiHandler;
import com.xhwl.centiotdata.utils.ThreadPoolExecutorService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Author： lianghz
 * @Description：
 * @Date 2021/09/06/ 11:31
 */
@Service
public class EesdBAHandler extends EesdHandler {

    @Autowired
    private BaApiHandler baApiHandler;

    @Override
    public void afterPropertiesSet() {
        EesdFactory.register(EesdMethodEnum.BA_TOWN.getId(), this);
    }

    @Override
    public void pullRecord(EesdConfigDTO eesdConfigDTO) {
        //拉取电表和读数
        baApiHandler.pullRecord(eesdConfigDTO);
    }


    @Override
    public void pullEnvTenMinusData(EesdConfigDTO config) {
        //拉取设备状态和判断告警
        baApiHandler.pullDevicesCheckAlarm(config);
    }

    @Override
    public void pullDevice(EesdConfigDTO eesdConfigDTO) {
        //拉取BA设备
        ThreadPoolExecutorService.getThreadPool().submit(() -> {
            baApiHandler.pullBaDevice(eesdConfigDTO);
        });
    }
}
